class Account::PasswordsController < Account::BaseController
  

  filter_parameter_logging :password,
                           :password_new,
                           :password_new_repeat

  def update

    if !@account.check_password(params[:password])
      @account.errors.add_to_base('Uw huidige wachtwoord is niet correct.')
    elsif params[:password_new] != params[:password_new_repeat]
      @account.errors.add_to_base('Uw wachtwoorden komen niet overeen.')
    else
      @account.update_attributes(:password => params[:password_new] )
    end

    if @account.errors.size > 0
      render :action => 'edit'
    else
      flash[:notice] = 'Uw wachtwoord is aangepast.'

      redirect_to account_path
    end
  end

end